﻿// =================================================================== 
// 业务逻辑层(GDIT.BLL)
//====================================================================
// 文件：BBulletinArticle.cs
// 项目名称：学院网站
// 创建时间：2012-08-08
// 负责人：ChenZhiGang
//引用DevExpress.Data.Filtering，DevExpress.Xpo程序集
// 程序集介绍：风貌操作逻辑
// ===================================================================
using DevExpress.Xpo;
using DevExpress.Data.Filtering;
using GDIT.Base.LogHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using GDIT.Model;

namespace GDIT.BLL
{
    public class BSceneryPicInfo
    {

        private Pattern.DALAbstractFactory dataFactory = DataProvider.defaultProvider;

        /// <summary>
        /// 根据输入的类型对风貌进行查询并返回
        /// </summary>
        /// <param name="typeName">类型</param>
        /// <returns></returns>
        public IDataReader SelectSceneryPicInfoByType(string typeName)
        {
            return dataFactory.DALSceneryPicInfoProvider.SelectSceneryPicInfoByType(typeName);
        }

        /// <summary>
        /// 新增加一篇公告
        /// </summary>
        /// <param name="bulletin">需要增加的公告对象</param>
        /// <returns>1：新增成功  0：新增失败</returns>
        public bool InsertSceneryPicInfo(Mtb_SceneryPicInfo bulletin)
        {
            Logger.Info(String.Format("新增风貌的名称[{0}]", bulletin.Title));
            int result = dataFactory.DALSceneryPicInfoProvider.InsertSceneryPicInfo(bulletin);
            if (result == 1)
            {
                Logger.Info("Insert success");
                return true;
            }
            else
            {
                Logger.Info("Insert false");
                return false;
            }
        }

        /// <summary>
        /// 删除一篇公告
        /// </summary>
        /// <param name="bulletin">需要删除的公告对象</param>
        /// <returns>1：删除成功  0：删除失败</returns>
        public bool DeleteSceneryPicInfo(int id)
        {
            Logger.Info(String.Format("删除的风貌对象ID[{0}]", id));
            int result = dataFactory.DALSceneryPicInfoProvider.DeleteSceneryPicInfo(id);
            if (result == 1)
            {
                Logger.Info("Insert success");
                return true;
            }
            else
            {
                Logger.Info("Insert false");
                return false;
            }
        }

        /// <summary>
        /// 更新一篇公告
        /// </summary>
        /// <param name="bulletin">需要更新的公告的对象</param>
        /// <returns>1：更新成功  0：更新失败</returns>
        public bool UpdateSceneryPicInfo(Mtb_SceneryPicInfo bulletin)
        {
            Logger.Info(String.Format("更新的风貌对象[{0}]", bulletin.Title));
            int result = dataFactory.DALSceneryPicInfoProvider.UpdateSceneryPicInfo(bulletin);
            if (result == 1)
            {
                Logger.Info("Insert success");
                return true;
            }
            else
            {
                Logger.Info("Insert false");
                return false;
            }
        }
    }
}
